package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.CqggzyProjectResults;
import com.ruoyi.business.service.ICqggzyProjectResultsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 重庆市联交所交易结果Controller
 * 
 * @author blaze
 * @date 2025-08-08
 */
@RestController
@RequestMapping("/business/guarantee")
public class CqggzyProjectResultsController extends BaseController
{
    @Autowired
    private ICqggzyProjectResultsService cqggzyProjectResultsService;

    /**
     * 查询重庆市联交所交易结果列表
     */
    @PreAuthorize("@ss.hasPermi('business:guarantee:list')")
    @GetMapping("/list")
    public TableDataInfo list(CqggzyProjectResults cqggzyProjectResults)
    {
        startPage();
        List<CqggzyProjectResults> list = cqggzyProjectResultsService.selectCqggzyProjectResultsList(cqggzyProjectResults);
        return getDataTable(list);
    }

    /**
     * 导出重庆市联交所交易结果列表
     */
    @PreAuthorize("@ss.hasPermi('business:guarantee:export')")
    @Log(title = "重庆市联交所交易结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CqggzyProjectResults cqggzyProjectResults)
    {
        List<CqggzyProjectResults> list = cqggzyProjectResultsService.selectCqggzyProjectResultsList(cqggzyProjectResults);
        ExcelUtil<CqggzyProjectResults> util = new ExcelUtil<CqggzyProjectResults>(CqggzyProjectResults.class);
        util.exportExcel(response, list, "重庆市联交所交易结果数据");
    }

    /**
     * 获取重庆市联交所交易结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:guarantee:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(cqggzyProjectResultsService.selectCqggzyProjectResultsById(id));
    }

    /**
     * 新增重庆市联交所交易结果
     */
    @PreAuthorize("@ss.hasPermi('business:guarantee:add')")
    @Log(title = "重庆市联交所交易结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CqggzyProjectResults cqggzyProjectResults)
    {
        return toAjax(cqggzyProjectResultsService.insertCqggzyProjectResults(cqggzyProjectResults));
    }

    /**
     * 修改重庆市联交所交易结果
     */
    @PreAuthorize("@ss.hasPermi('business:guarantee:edit')")
    @Log(title = "重庆市联交所交易结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CqggzyProjectResults cqggzyProjectResults)
    {
        return toAjax(cqggzyProjectResultsService.updateCqggzyProjectResults(cqggzyProjectResults));
    }

    /**
     * 删除重庆市联交所交易结果
     */
    @PreAuthorize("@ss.hasPermi('business:guarantee:remove')")
    @Log(title = "重庆市联交所交易结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(cqggzyProjectResultsService.deleteCqggzyProjectResultsByIds(ids));
    }
}
